package com.ruoyi.tplus.config;

import com.ruoyi.tplus.Interceptor.MyInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @Author: zhanglm
 * @CreateDate: 2025-06-19 13:41
 * @FullNameClass: com.ruoyi.kis.config.WebMvcConfig
 * @Description:
 */
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {

    @Autowired
    private MyInterceptor myInterceptor;
    @Autowired
    private RepeatSubmitInterceptor repeatSubmitInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(myInterceptor)    // 添加拦截器
                .addPathPatterns("/**")           // 拦截所有请求
                .excludePathPatterns("/login")    // 排除登录请求
                .excludePathPatterns("/static/**"); // 排除静态资源
        registry.addInterceptor(repeatSubmitInterceptor).addPathPatterns("/**");

    }


}
